package test;

import java.util.ArrayList;
import java.util.Iterator;

public class ForTest1 {
    public static void main(String[] args) {
        ArrayList a = new ArrayList();
        for (int i = 0; i < 10; i++) {
            a.add(i);
        }

        int i = 0;
//        for (Object o : a) {
//            System.out.println(o);
//            if (i++ == 1) {
//                a.remove(i);
//            }
//        }

        Iterator iterator = a.iterator();
        while (iterator.hasNext()) {
            Object next = iterator.next();
            if (next.equals(1)) {
                iterator.remove();
            }
        }
    }
}

